from django.conf.urls.defaults import *
from django.contrib import admin
from trims import views

admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^comments/', include('django.contrib.comments.urls')),

    (r'^tickets/recent/$', views.checkin_history),
    
    (r'^login/$', 'django.contrib.auth.views.login'),

#	(r'^ajaxtest/$', views.ajaxtest), # TODO: Delete me!
    
    (r'^checkin/new/(?P<tech_id>[0-9]+)/(?P<site_id>[0-9]+)/$', views.checkin_new),
    url(r'^checkin/notify/((?P<type>[\w]+)/)?$', views.notify, name="notify"),
    (r'^checkin/badge/(?P<tech_id>[0-9]+)/$', views.checkin_badge),
    (r'^checkin/badge/(?P<tech_name>[a-zA-Z_]+)/$', views.checkin_badge),

    # for history ex: /checkin/history/Shaun_Martin/Sturgeon_Heights_Collegiate/22-05-2011/22-06-2011/
    # dates are optional, but if one is included, both must be included.
    (r'^checkin/history/((?P<tech_name>[a-zA-Z_]+)/)?((?P<site_name>[a-zA-Z_]+)/)?((?P<dt_start>[0-9]{2}-[0-9]{2}-[0-9]{4})/(?P<dt_end>[0-9]{2}-[0-9]{2}-[0-9]{4})/)?((?P<template>html|csv)/)?$', views.checkin_history),

    # for advanced history ex: /checkin/history/232_56743_28_75/28_27_30/22-05-2011/22-06-2011/csv/
    # dates are optional, but if one is included, both must be included. default: dt_end = today, dt_start = today - 3 months
    # the template tag at the end is optional, can be html or csv. default: html
    (r'^checkin/history/((?P<tech_ids>[0-9_]+)/)?((?P<site_ids>[0-9_]+)/)?((?P<dt_start>[0-9]{2}-[0-9]{2}-[0-9]{4})/(?P<dt_end>[0-9]{2}-[0-9]{2}-[0-9]{4})/)?$', views.checkin_adv_history),
)
